package redis;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import redis.clients.jedis.Jedis;

public class TestMs {

    public static void main(String[] args) throws InterruptedException {
        Jedis jedis = new Jedis("192.168.17.128");
        jedis.set("iphone8", "100");
        jedis.close();
        //玩多线程
        ExecutorService executor = Executors.newFixedThreadPool(20);

        for (int i = 0; i < 2000; i++) {
            executor.execute(new SaleRunable("user" + i));
        }
//        Thread.sleep(1000 * 10);
        executor.shutdown();
        System.out.println("抢购完成！");

    }


}